<?php if (!defined('NOVA_RUN')) die('You can\'t access this file directly!');

function __autoload($class)
{
	// classes
	$file = $class . '.class.php';
	
	if (file_exists(ROOT . 'engine/classes/' . $file))
	{
		require ROOT . 'engine/classes/' . $file;
		
		return;
	}

	// objects
	$file = strtolower(str_replace('_', '.', $class)) . '.php';
	
	if (file_exists(ROOT . 'engine/objects/' . $file))
	{
		require ROOT . 'engine/objects/' . $file;
		
		return;
	}

	// models
	$file = strtolower(str_replace('_', '.', $class)) . '.php';
	
	if (file_exists(ROOT . 'engine/models/' . $file))
	{
		require ROOT . 'engine/models/' . $file;
		
		return;
	}

	// exception
	throw new Exception('Class \'' . $class . '\' could not be located!');
}

?>